package com.xbts.system.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import com.xbts.common.annotation.Excel;
import com.xbts.common.utils.StringUtils;
import com.xbts.common.core.domain.BaseEntity;

/**
 * 站内消息用户关系 对象 sys_message_user
 *
 * @author xbts
 * @date 2023-10-25
 */
@Data
@ApiModel("站内消息用户关系 对象")
@TableName("sys_message_user")
public class SysMessageUser extends BaseEntity {

    private static final long serialVersionUID=1L;

    /** ID */
    @TableId
    private String id;

    /** 用户id */
    @Excel(name = "用户id")
    @ApiModelProperty("用户id")
    @NotEmpty(message = "用户id不能为空")
    private String userId;

    /** 公告id */
    @Excel(name = "公告id")
    @ApiModelProperty("公告id")
    @NotEmpty(message = "公告id不能为空")
    private String noticeId;

    /** 公告状态（0未读 1已读） */
    @Excel(name = "公告状态", readConverterExp = "0=未读,1=已读")
    @ApiModelProperty("公告状态")
    @NotEmpty(message = "公告状态不能为空")
    private String status;

    public<T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> queryWrapper=new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotEmpty(userId),"user_id",userId);
        queryWrapper.like(StringUtils.isNotEmpty(noticeId),"notice_id",noticeId);
        queryWrapper.like(StringUtils.isNotEmpty(status),"status",status);
        return queryWrapper;
    }
}